#ifndef BOSS_Afterburner_NamedObject_H
#define BOSS_Afterburner_NamedObject_H
#include "TString.h"
#include <yaml-cpp/yaml.h>

/// @addtogroup Afterburner_objects
/// @{

/// @author   Remco de Boer 雷穆克 (r.e.deboer@students.uu.nl or remco.de.boer@ihep.ac.cn)
/// @date     April 12th, 2019
class NamedObject
{
public:
  NamedObject(const TString& name = "", const TString& title = "");

  void SetName(const TString& name) { fName = name; }
  void SetName(const YAML::Node& input);
  void SetTitle(const TString& title) { fTitle = title; }
  void SetTitle(const YAML::Node& input);
  void SetNameAndTitle(const TString& name, const TString& title);

  Bool_t HasName() const { return !fName.EqualTo(""); }
  Bool_t HasTitle() const { return !fTitle.EqualTo(""); }
  Bool_t HasNameAndTitle() const { return HasName() && HasTitle(); }
  Bool_t HasNameOrTitle() const { return HasName() || HasTitle(); }

  const char* GetName() const { return fName.Data(); }
  const char* GetTitle() const { return fTitle.Data(); }

  virtual const TString BuildString() const { return BuildString_Named(); }

  const TString BuildString_Named() const;

private:
  TString fName;
  TString fTitle;
};

/// @}
#endif